﻿using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Hosting;

namespace Athena.Performance.Compare
{
    using Athena.Options;
    using Athena.Transport.DotNetty;
    using Athena.Transport.BeetleX;
    using Zeus.Mvc;
    using Zeus.Mvc.Options;
    using ProxyGenerator;

    public class Startup
    {
        private ZeusMvcOptions _zeusMvcOptions;
        private RabbitMqBus _rabbitMqBus;

        public Startup()
        {
            _zeusMvcOptions = new ZeusMvcOptions();
        }

        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvcCore().AddZeus();
            services.AddAthenaCore(new ServiceDescriptor()
            {
                Id = "athena.xunit.client.test",
                Name = "雅典娜RPC-client-Test"
            }, new AthenaOptions()
            {
                RouteAddressOption = new RouteAddressOption()
                {
                    FileServiceMultipleRouteDirectory = "C:\\athena\\routes"
                }
            });
            services.AddDefaultClientRuntime();
            services.AddAthenaProxy();
            services.AddDotNettyTransport();
        }

        public void Configure(IApplicationBuilder app, IApplicationLifetime applicationLifetime, ILogger<RabbitMqBus> logger)
        {
            app.UseZeus();
            app.UseMvc();
        }
    }

}
